package phase01module02.homework;

/**
 * 手机卡类
 */

//6.创建手机卡类，打印手机卡信息
public class PhoneCard {
    private String cardType;   //卡类型
    private String cardNumber; //卡号
    private String usename;    //用户名
    private String password;   //密码
    private int accountBalance;//账户余额
    private int teleTime;      //通话时间
    private int surfFlow;      //上网流量

    TeleClass teleClass = new TeleClass();
    SurfClass surfClass = new SurfClass();

    public PhoneCard() {
    }

    //初始化手机卡
    public PhoneCard(String cardType, String cardNumber, String usename, String password, int accountBalance, int teleTime, int surfFlow) {
        setCardType(cardType);
        setCardNumber(cardNumber);
        setUsename(usename);
        setPassword(password);
        setAccountBalance(accountBalance);
        setTeleTime(teleTime);
        setSurfFlow(surfFlow);
    }

    public String getCardType() {
        return cardType;
    }

    public void setCardType(String cardType) {
        this.cardType = cardType;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public void setCardNumber(String cardNumber) {
        this.cardNumber = cardNumber;
    }

    public String getUsename() {
        return usename;
    }

    public void setUsename(String usename) {
        this.usename = usename;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getAccountBalance() {
        return accountBalance;
    }

    public void setAccountBalance(int accountBalance) {
        this.accountBalance = accountBalance;
    }

    public int getTeleTime() {
        return teleTime;
    }

    public void setTeleTime(int teleTime) {
        this.teleTime = teleTime;
    }

    public int getSurfFlow() {
        return surfFlow;
    }

    public void setSurfFlow(int surfFlow) {
        this.surfFlow = surfFlow;
    }

    //订购上网套餐
    //1.show方法传多个参数方式接收对象
    //打印账户信息
    public void show(int... args){
        System.out.println("----------手机卡信息-------------");
        for(int i = 0; i < args.length; i++){
            if(0 == i){
                setTeleTime(args[i]);
            }else{
                setSurfFlow(args[i]);
            }
        }
        showAccountBalance();
    }

    //2.打印账户余额
    public void showAccountBalance(){
        System.out.println("---------账户余额----------");
        System.out.println("手机卡类型是" + getCardType() + "\n卡号：" + getCardNumber() + "\n用户名：" + getUsename() + "\n密码：" + getPassword() + "\n账户余额：" + getAccountBalance() + "\n历史通话时长：" + getTeleTime() + "\n历史流量使用情况：" + getSurfFlow() + "GB");
    }

    //3.创建通话消费方法，传入到普通通话类中
    public void addTele(int a, PhoneCard phoneCard){
        teleClass.telePackage(a, phoneCard);
    }

    //4.创建流量消费方法addSurf，传入普通类上网类中
    public void addSurf(int a, PhoneCard phoneCard){
        surfClass.surfPackage(a, phoneCard);
    }

}
